package com.car.Test;

import com.car.dao.UserDao;
import com.car.dao.impl.UserDaoImpl;
import com.car.domain.Employee;
import com.car.domain.User;
import org.junit.Test;

import java.util.List;

public class UserDaoImplTest {
    private static final  UserDao userDao=new UserDaoImpl();
    @Test
    public void add() throws Exception {
        User user=new User();
        user.setName("梁涛");
        user.setPassword("123456");
        user.setPhone("10086");
        user.setEmail("test@test.com");
        userDao.add(user);
    }

    @Test
    public void delete() throws Exception {
        int delete=userDao.delete(1);
    }

    @Test
    public void update() throws Exception {
        User user=userDao.queryById(1);
        user.setName("Anna");
        userDao.update(user);
    }

    @Test
    public void queryById() throws Exception {
        User user=userDao.queryById(1);
        System.out.println(user);
    }

    @Test
    public void queryAll() throws Exception {
        List<User> users = userDao.queryAll();
        System.out.println(users);
    }

    @Test
    public void register() {
        User user=new User();
        user.setName("小帅");
        user.setPhone("1500252144");
        user.setEmail("test@test.com");
        user.setPassword("123456");
        boolean register = userDao.register(user);
        System.out.println(register);

    }
    @Test
    public void findByPhone() throws Exception {
        User byPhone = userDao.findByPhone("1500252144");
        System.out.println(byPhone);
    }

    @Test
    public void login(){
        User user = userDao.login("100861","123456");
        System.out.println(user);
    }
}